package com.tepth.appmanageservice.protocol.bodys.ordinaryfile;

import com.tepth.appmanageservice.protocol.Index;
import com.tepth.appmanageservice.protocol.interfaces.IReceive;
import com.tepth.appmanageservice.tools.ext.ExtToBytes;
import com.tepth.appmanageservice.tools.ext.ExtToInt;

public class OrdinaryFileRequestReply implements IReceive {
	public static final short ID = 0x0C23;

	private short replySerialNumber;// Ӧ����ˮ��
	private byte fileType;// �ļ�����
	private short packetNo; // �����
	private byte[] datas; // ������

	public short getReplySerialNumber() {
		return this.replySerialNumber;
	}

	public void setReplySerialNumber(short replySerialNumber) {
		this.replySerialNumber = replySerialNumber;
	}

	public byte getFileType() {
		return this.fileType;
	}

	public void setFileType(byte fileType) {
		this.fileType = fileType;
	}

	public short getPacketNo() {
		return this.packetNo;
	}

	public void setPacketNo(short packetNo) {
		this.packetNo = packetNo;
	}

	public byte[] getDatas() {
		return this.datas;
	}

	public void setDatas(byte[] datas) {
		this.datas = datas;
	}

	@Override
	public short getLength() {
		return (short) this.datas.length;
	}

	@Override
	public void setLength(int length) {

	}

	@Override
	public void Receive(byte[] data, Index index) {
		this.replySerialNumber = ExtToInt.fromByteArrayTo16(data, index);
		this.fileType = data[index.get()];
		this.packetNo = ExtToInt.fromByteArrayTo16(data, index);
		this.datas = ExtToBytes.fromByteArray(data, index, data.length - index.Value());
	}
}